#-*- coding: utf8 -*-
from tutor.scripts import *
from tutor.plugins.sympy import *

niter = 0
with display_block('Entradas'):
    while True:
        niter += 1
        vars = [x, y];
        shuffle(vars)
        u, v = vars
        alpha, beta = oneof([1, 1], [1, 8], [2, 2], [2, 8], [3, 3], [3, 12])

        numer = (((u - v) * oneof(u, v)).expand())
        denom = sqrt(u) - sqrt(v)
        func = numer / denom / sqrt(alpha)
        point = (beta, beta)

        if alpha == 1:
            raiz = ''
        else:
            denom = Symbol('\\sqrt{%s}' % alpha) * denom

        answer = 2 * beta * sqrt(beta / alpha)
        if not (answer in [1, 2, 3, 4, 5, 6]):
            continue
        else:
            break

# Salva resposta
g0, g1, g2, g3, g4, g5, g6, g7 = [0] * 8
if answer is None:
    g7 = 1
else:
    locals()['g%s' % answer] = 1
    assert (answer in range(7))
    assert 1 in [ g0, g1, g2, g3, g4, g5, g6, g7 ]

# Mostra resultados
with display_block('Resultados'):
    answers = list(enumerate([ g0, g1, g2, g3, g4, g5, g6, g7 ]))

